package com.yunhe.sms.view;

import com.yunhe.sms.control.LoginController;

import java.util.Scanner;

public class Password {
    public static int  passwordChangeUI(){
        System.out.println("********************学员信息管理系统-"+ LoginController.getCurrUser().getRealName()+"********************");
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入新的密码：");
        String password = sc.next();
        System.out.print("请再次输入新的密码：");
        String newPassword = sc.next();
        if (password!=null&&password.equals(newPassword)){
            LoginController.getCurrUser().setPassword(password);
            System.out.println("修改成功！");
        }else {
            System.out.println("输入密码不正确，请重新输入！");
            passwordChangeUI();
        }
        System.out.println("1.返回主页\t\t2.退出登录");
        System.out.print("请输入操作码：");
        int i = sc.nextInt();
        return i;
    }
}
